package com.cta.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "cta_tariff")
public class TariffRecord implements BaseEntity {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "cta_tariff_seq")
	@SequenceGenerator(name = "cta_tariff_seq", sequenceName = "cta_tariff_seq")
	@Column(name = "id", unique = true, nullable = false)
	private Long id;

	@Column(name = "name", unique = true, nullable = false)
	private String name;

	@Column(name = "description", nullable = true)
	private String description;

	@Column(name = "holiday_discount_value")
	private int holidayDiscountValue;

	@OneToMany(fetch = FetchType.LAZY)
	@JoinColumn(name = "tariff_id")
	private List<DiscountRate> discountRates;

	public TariffRecord() {
	}

	public TariffRecord(Long id) {
		this.id = id;
	}

	public TariffRecord(String name) {
		this.name = name;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getHolidayDiscountValue() {
		return holidayDiscountValue;
	}

	public void setHolidayDiscountValue(int holidayDiscountValue) {
		this.holidayDiscountValue = holidayDiscountValue;
	}

	public List<DiscountRate> getDiscountRates() {
		return discountRates;
	}

	public void setDiscountRates(List<DiscountRate> discountRates) {
		this.discountRates = discountRates;
	}

}
